# Maintainer: David Runge <dvzrv@archlinux.org>

_name=calmjs.types
pkgname=python-calmjs.types
pkgver=1.0.1
pkgrel=6
pkgdesc="Base types for calmjs framework"
arch=('any')
url="https://github.com/calmjs/calmjs.types"
license=('MIT')
depends=('python')
makedepends=('python-setuptools')
checkdepends=('python-pytest')
source=("https://files.pythonhosted.org/packages/source/${_name::1}/${_name}/${_name}-${pkgver}.zip")
sha512sums=('e6c14975de2391d55042f36c76f3cafcc690417240014af537b3dcdfee77d320f6d33afcb29c103ad23124aa6117bbd19a89d6a1542c307b141b8aa7f325ae32')

prepare() {
  mv -v "${_name}-${pkgver}" "$pkgname-$pkgver"
}

build() {
  cd "$pkgname-$pkgver"
  python setup.py build
}

check() {
  cd "$pkgname-$pkgver"
  export PYTHONPATH="build:${PYTHONPATH}"
  pytest -v
}

package() {
  cd "$pkgname-$pkgver"
  python setup.py install --skip-build \
    --optimize=1 \
    --prefix=/usr \
    --root="${pkgdir}"
  install -vDm 644 {CHANGES,README}.rst -t "${pkgdir}/usr/share/doc/${pkgname}"
  install -vDm 644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
}
